<style>
  img.recthumb{
        float:left;
        padding:15px 10px 0px 0px;
  }
  tr.result {
        min-height:110px;
        width:100%;
        border-width:1px;
        border-top-style:dotted;
        clear:both;
        float:left;
        margin-top:5px;
  }
  div.result h1 {
        font-size:16px;
  }

  #bookingButton{
    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    border-radius: 10px;
    border:none;
    width:150px;
    height:35px;
    color:#fff;
    font-size:20px;
    border:#FFF 3px solid;
    background-color:#0896ff;
    text-shadow: 0.05em 0.05em 0.05em #333;
    float:right;
  }

  #bookingButton a{
    color:#fff;
  }

  #bookingButton a:hover{
    text-decoration:none;
  }

  #distance{
    color:#cccccc;
  }

  #address{
    color:#ff9900;
  }

  #link{
    color:#3366ff;
    font-weight:bolder;
  }

  #hotelname{
    color:#6AA118;
    font-size:16px;
    font-weight:bolder;
    
  }

</style>

<!--[group_availabilities_array avail=$view.Availabilities]-->

<script type="text/javascript">
  function validateNumberOfRoom(){

    var rows = <!--[$groupAvailabilities|@count]-->;
    
    var number = 0;
    var validate = false;
    for (i=0;i<rows;i++){
      number = document.getElementById("number_"+i).value;
      //alert(number+"<br>");
      if(number > 0){
        validate = true;
      }
    }

    if(!validate) {
      alert("<!--[pnml name='_POBPORTAL_ERROR_SELECT_ROOM']-->");
      return false;
    }
  }
</script>
<script type="text/javascript" src="modules/POBPortal/pnjavascript/wz_tooltip.js"></script> 
<form method="post" action="https://www.phuketcity.com/index.php?module=POBBooking">
<input type="hidden" name="transaction[url]" value="<!--[$view.URL]-->">
<input type="hidden" name="transaction[hotelname]" value="<!--[$view.HotelName]-->">
<input type="hidden" name="transaction[hotelcode]" value="<!--[$view.HotelCode]-->">
<input type="hidden" name="transaction[description]" value="<!--[$view.Description]-->">
<input type="hidden" name="transaction[contactinfo]" value="<!--[$view.AddressLine]-->, <!--[$view.StateProv]-->, <!--[$view.CountryName]-->, <!--[$view.PostalCode]-->">
<input type="hidden" name="transaction[hotelname]" value="<!--[$view.HotelName]-->">
<input type="hidden" name="transaction[image]" value="<!--[$view.ImageItems[0].Images]-->">
<input type="hidden" name="transaction[thumb]" value="<!--[$view.ImageItems[0].Thumbs]-->">

<input type="hidden" name="transaction[policyname]" value="<!--[$view.PolicyName]-->">
<input type="hidden" name="transaction[policytext]" value="<!--[$view.PolicyText]-->">

  <table width="100%">
      <tr onmouseover="this.bgColor='#ecf5ff'" onmouseout="this.bgColor='#ffffff'">
        <td valign="top">
            <span id="hotelname"><a href="#"><!--[$view.HotelName]--></a></span> 
            <img src="modules/POBPortal/pnimages/stars<!--[$view.Rating]-->.gif" width="66px" height="12px" align="absmiddle" alt="ประกาศ" title="rating"/>
            <em id="address"><!--[$view.AddressLine]-->, <!--[$view.StateProv]-->, <!--[$view.CountryName]-->, <!--[$view.PostalCode]--></em><br>
        </td>
      </tr>
      <tr onmouseover="this.bgColor='#ecf5ff'" onmouseout="this.bgColor='#ffffff'">
        <td valign="top">
          <!--[if isset($view.ImageItems)]-->
            <!--[foreach from=$view.ImageItems item=image]-->
              <a class="image_border" target="_blank" href="#" 
                  onmouseover="Tip('&lt;img src=\'<!--[$image.Images]-->\' width=\'450\'/&gt;')" 
                  onmouseout="UnTip()
              ">
                  <img src="<!--[$image.Thumbs]-->" class="recthumb">
              </a>&nbsp;
            <!--[/foreach]-->
          <!--[/if]--><br>
        </td>
      </tr>
      <tr>
        <td>
          &nbsp;    
        </td>
      </tr>
      <tr class="result" onmouseover="this.bgColor='#ecf5ff'" onmouseout="this.bgColor='#ffffff'">
        <td>
            <p class="description2"><!--[$view.Description]-->&nbsp;&nbsp;</p>
        </td>
      </tr><br><br>
      <br>
      <!--       [$view.Availabilities|@print_r]        -->
      <!--[foreach from=$view.Availabilities item=tempAvailabilities name=foo]-->
          <input type="hidden" name="transaction[availabilities][<!--[$smarty.foreach.foo.index]-->][invcode]" value="<!--[$tempAvailabilities.InvCode]-->">
          <input type="hidden" name="transaction[availabilities][<!--[$smarty.foreach.foo.index]-->][date]" value="<!--[$tempAvailabilities.Date]-->">
          <input type="hidden" name="transaction[availabilities][<!--[$smarty.foreach.foo.index]-->][rate]" value="<!--[$tempAvailabilities.Rate]-->">
      <!--[/foreach]-->

      <!--[if $tempAvailabilities.Limit]-->
      <tr>
        <td>
            <table width="100%">
              <tr>
                <th width="40%" align="left"><!--[pnml name="_POBPORTAL_AVAILABLE_ROOM_TYPE"]--></th>
                <th width="15%" align="center"><!--[pnml name="_POBPORTAL_AVAILABLE_ROOM_AMOUNT"]--></th>
                <th width="15%" align="center"><!--[pnml name="_POBPORTAL_ROOM_AMOUNT"]--></th>
                <th width="30%" align="right"><!--[pnml name="_POBPORTAL_ROOM_RATE"]--></th>
              </tr>


              <!--[foreach from=$groupAvailabilities item=itemAvailabilities name=foo]-->

                <input type="hidden" 
                       name="transaction[roomstays][<!--[$smarty.foreach.foo.index]-->][invcode]" 
                       value="<!--[$itemAvailabilities.InvCode]-->"
                  >
                <input type="hidden" 
                       name="transaction[roomstays][<!--[$smarty.foreach.foo.index]-->][rate]" 
                       value="<!--[$itemAvailabilities.Rate]-->"
                >
                <input type="hidden" 
                       name="transaction[roomstays][<!--[$smarty.foreach.foo.index]-->][startdate]" 
                       value="<!--[$smarty.get.startDate]-->"
                >
                <input type="hidden" 
                       name="transaction[roomstays][<!--[$smarty.foreach.foo.index]-->][enddate]" 
                       value="<!--[$smarty.get.endDate]-->"
                >

                    <!--[if $itemAvailabilities.Limit > 0]-->
                      <tr>
                        <td align="left">
                          <a href="index.php?module=POBPortal&type=search&func=view&lat=<!--[$view.Latitude]-->&lon=<!--[$view.Longitude]-->&startDate=<!--[$view.startDate]-->&endDate=<!--[$view.endDate]-->&InvCode=<!--[$itemAvailabilities.InvCode]-->">
                            <!--[$itemAvailabilities.InvCode]-->
                          </a>
                        </td>
                        <td align="center"><!--[$itemAvailabilities.Limit]--></td>
                        <td align="center">
                          <select id="number_<!--[$smarty.foreach.foo.index]-->" 
                                  name="transaction[roomstays][<!--[$smarty.foreach.foo.index]-->][numberofunit]"
                          >
                            <!--[math equation="x+y" x=$itemAvailabilities.Limit y=1 assign="amountLimitRoom"]-->
                            <!--[section name=limit loop=$amountLimitRoom  start=0 step=1]-->
                              <option value="<!--[$smarty.section.limit.index]-->" ><!--[$smarty.section.limit.index]-->
                            <!--[/section]-->
                          </select>
                        </td>
                        <td align="right">THB <!--[$itemAvailabilities.Rate|number_format:2:".":","]--></td>
                      </tr>
                  <!--[/if]-->
              <!--[/foreach]-->
            </table>
        </td>
      </tr>
      <tr>
        <td>&nbsp;
        </td>
      </tr>
      <tr align="right">
        <td><button id="bookingButton" type="submit" onclick="return validateNumberOfRoom();"><!--[pnml name="_POBPORTAL_BOOKING_BUTTON"]--></button></td>
      </tr>
      <!--[/if]-->
  </table>
</form>
